﻿@using FormBuilder.Components.Drag
@using FormBuilder.Helpers
@inject ITranslationHelper translationHelper
@inject IHtmlClassResolver htmlClassResolver

<DraggableFormElement IsViewSettingsDisabled="@IsViewSettingsDisabled" IsEditModeEnabled=@IsEditModeEnabled ParentContext="@ParentContext" Context="@Context" TDialog="FormInputDialog" TRecord="FormInputFieldRecord" Record="@Value">
     <Children>
        @if (Value.FormType != FormInputTypes.HIDDEN)
        {
            <div class="@htmlClassResolver.Resolve(Value, FormInputElementNames.Container, Context)">
                <RadzenLabel class="@htmlClassResolver.Resolve(Value, FormInputElementNames.Label, Context)" Text="@translationHelper.Translate(Value, InputData, !IsEditModeEnabled)"></RadzenLabel>
                <RadzenTextBox class="@htmlClassResolver.Resolve(Value, FormInputElementNames.TextBox, Context)" Name="@Value.Name" @bind-Value="@Value.Value" Disabled=@Value.Disabled></RadzenTextBox>
            </div>
        }
        else
        {
            if(IsEditModeEnabled)
            {
                <span>@($"Configure the hidden type {Value.Name}")</span>
            }
            else
            {
                <input type="hidden" value="@Value.Value" name="@Value.Name" />
            }
        }
    </Children>
</DraggableFormElement>